<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<body>
<form class="layui-form layui-form-pane" id="operatePage">
    <div class="page-title">
        <div class="page-title-con">
            <span>编辑体验注册信息</span>
            <div class="move_title"></div>
            <?php include "../public/sub.php";?>
        </div>
    </div>

    <div class="main-container">
        <div class="layui-form-item">
            <div class="layui-row layui-col-space10">
                <div class="layui-col-md12">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-block">
                        <input type="text"  id="reg_name" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row layui-col-space10">
                <div class="layui-col-md12">
                    <label class="layui-form-label">手机号</label>
                    <div class="layui-input-block">
                        <input type="text"  id="reg_tel" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row layui-col-space10">
                <div class="layui-col-md12">
                    <label class="layui-form-label">体验开始时间</label>
                    <div class="layui-input-block">
                        <input type="text"  id="created_at" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-row layui-col-space10">
                <div class="layui-col-md12">
                    <label class="layui-form-label">体验到期时间</label>
                    <div class="layui-input-block">
                        <input type="text" name="reg_enddt" id="reg_enddt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymdhi">
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-form-item height_auto">
            <div class="layui-row layui-col-space10">
                <div class="layui-col-md12">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <textarea id="explain" name="explain" placeholder="请输入" class="layui-textarea"></textarea>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
<script>
    var param_id = getQueryVariable('id') || 0;


    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;

        facade.ajax({type: 'get', url: ask_userreg_edit, data:{id:param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;

                $("#reg_name").val(data.reg_name);
                $("#reg_tel").val(data.reg_tel);
                $("#created_at").val(data.created_at);
                $("#reg_enddt").val(data.reg_enddt);
                $("#explain").val(data.explain);

                render_from();
            }
        });

        form.on('submit(add)', function(data){
            var validRes = $("#operatePage").valid();
            if(!validRes){return false;}

            data.field.id = param_id;
            facade.ajax({url: ask_userreg_edit, data:data.field}).done(function(res){
                if (res.code === 2000) {
                    dataPostTimeOut();
                }
            });

            return false;
        });

    });

</script>
</body>
</html>
